{extend name="base"/}

{block name="box"}
<div class="layui-container fly-marginTop">
  <div class="fly-panel fly-panel-user" pad20>
    <div class="layui-tab layui-tab-brief" lay-filter="user">
      <ul class="layui-tab-title">
        <li><a href="{{:url('User/login')}}">登入</a></li>
        <li class="layui-this">找回密码<!--重置密码--></li>
      </ul>
      <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
        <div class="layui-tab-item layui-show">
          <!-- 重置密码 -->
          
          <div class="fly-msg repassword">请重置您的密码</div>
          <div class="layui-form layui-form-pane repassword">
            <form action="{{:url('User/rePwdDo')}}" method="post" id="secend">
              <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                  <input type="password" id="L_pass" name="pass" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">6到16个字符</div>
              </div>
              <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">确认密码</label>
                <div class="layui-input-inline">
                  <input type="password" id="L_repass" name="repass" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux"></div>
              </div>
              <div class="layui-form-item">
                <label for="L_vercode" class="layui-form-label">人类验证</label>
                <div class="layui-input-inline">
                  <input type="text" id="L_vercode" name="vercode" required lay-verify="required" placeholder="请输入后面的验证码" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">
                  <!-- <span style="color: #c00;">{{d.vercode}}</span> -->
                  <img src="{{:captcha_src()}}" alt="captcha" style="height: 38px;margin-top: -8px" onclick="this.src=this.src+'?i='+Math.random()"/>
                </div>
              </div>
              <div class="layui-form-item">
                <input type="hidden" name="username" value="{{d.username}}">
                <input type="hidden" name="email" value="{{d.email}}">
                <button class="layui-btn" lay-submit>提交</button>
              </div>
            </form>
          </div>
          
          
          
        </div>
      </div>
    </div>
  </div>

  
</div>

<div class="fly-footer">
  <p><a href="http://fly.layui.com/" target="_blank">Fly社区</a> 2017 &copy; <a href="http://www.layui.com/" target="_blank">layui.com 出品</a></p>
  <p>
    <a href="http://fly.layui.com/jie/3147/" target="_blank">付费计划</a>
    <a href="http://www.layui.com/template/fly/" target="_blank">获取Fly社区模版</a>
    <a href="http://fly.layui.com/jie/2461/" target="_blank">微信公众号</a>
  </p>
</div>

<script>
    var check_pass = false;
    $("#L_pass").blur(function(){
        
        var pass = $("#L_pass").val();
        if(pass.length > 16 || pass.length < 6){
           $("#L_pass").parent().next().removeClass("layui-word-aux").css("color","red");
           check_pass = false;
        }else{
            $("#L_pass").parent().next().addClass("layui-word-aux");
            check_pass = true;
        }
    })

    var check_repass = false;
    $("#L_repass").blur(function(){
        
        var repass = $("#L_repass").val();
        var pass = $("#L_pass").val();

        if(repass != pass){
           $("#L_repass").parent().next().removeClass("layui-word-aux").css("color","red");
           $("#L_repass").parent().next().html("两次输入密码不一致");
           check_repass = false;
        }else{
            $("#L_repass").parent().next().html("");
            check_repass = true;
            if(repass.length > 16 || repass.length < 6){
            $("#L_repass").parent().next().removeClass("layui-word-aux").css("color","red");
            $("#L_repass").parent().next().html("6到16个字符");
            check_repass = false;
            }else{
                $("#L_repass").parent().next().addClass("layui-word-aux");
                check_repass = true;
            }
        }
        
    })


    //如果上面有一个验证不通过,就不提交表单
    $("#second").submit(function(){
        //如果输入框有空值的,不提交表单

        if((check_email === true) && (check_username === true) && (check_pass === true) && (check_repass === true)){
            return true;
        }else{
            return false;
        }           
    })        
</script>

{/block}